﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using System.Xml;
using PloobsEngine.Particle3D;
using PloobsEngine.Light;
using PloobsEngine.Cameras;
using PloobsEngine.Trigger;
using PloobsEngine.Physics;
using PloobsEngine.Audio;

namespace PloobsEngine.SceneControl
{
    public interface IWorld
    {
        ParticleManager ParticleManager
        {
            get;            
        }
        int AddObject(IObject obj);
        void RemoveObject(IObject obj);
        void RemoveObject(int id);
        void UpdateWorld(GameTime gt);
        void DrawnWorld(GameTime gt ,IRenderHelper render);
        bool Contain(IObject obj);
        bool ContainNamedEntity(String name);
        int AddLight(ILight light);
        void RemoveLight(ILight light);
        /// <summary>
        /// Gerenciador de Camera
        /// EH AQ Q ADICIONAMOS/REMOVEMOS ... CAMERAS
        /// </summary>
        CameraManager CameraManager { get; }
        void AddTrigger(ITrigger trigger);
        void RemoveTrigger(ITrigger trigger);
        IPhysicWorld PhysicWorld { set; get; }        
        void Serialize(System.Xml.XmlTextWriter textWriter);
        void DeSerialize(System.Xml.XmlNode node, EngineStuff engine);        
        List<T> GetWorldGroupEntityByName<T>(String Name);        
        T GetWorldEntityByName<T>(String Name);    

        /// <summary>
        /// Objeto que nao esta no mundo realmente
        /// </summary>
        void AddDummy(IDummy dummy);
        void RemoveDummy(IDummy dummy);
        IList<IDummy> GetDummyes();    

        void ChangeEntityName(String oldName, String newName);
        ICuller Culler
        {
            set;
            get;
        }

        ICamera ActiveCamera
        {
            get;
        }
               
        /// Faz Ray test
        /// </summary>
        /// <param name="raio">Ray do Xna</param>
        /// <param name="method">considerar ou nao objetos imoveis</param>
        /// <param name="maxDistance">0 para qualquer distancia</param>
        /// <returns></returns>
        RayTestInfo SegmentIntersect(Ray raio, SegmentInterceptMethod method, float maxDistance);
        IList<ILight> Lights
        {
            get;
        }
        IList<IObject> Objects
        {
            get;
        }
        
        int ObjectsNum
        {
            get;
        }
        int Polycont
        {
            get;
        }

        ///Sound
        void AddSoundEmitter(ISoundEmitter3D em);
        void RemoveSoundEmitter(int id);
        void RemoveSoundEmitter(ISoundEmitter3D e);
    }
}
